package com.hebeiwangxiaozhang.admin.repo;

import com.hebeiwangxiaozhang.admin.pojo.CommoditySkuUpError;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommoditySkuUpErrorRepository extends JpaRepository<CommoditySkuUpError, Integer> {

    @Query(value = "select * from commodity_sku_up_error where epoch < 2 and status = 0", nativeQuery = true)
    List<CommoditySkuUpError> searchByEpochAndStatus();

    @Query(value = "update commodity_sku_up_error set epoch = ?2, status= ?3  where skuId = ?1", nativeQuery = true)
    void updateEpochAndStatus(Integer skuId, Integer epoch, Integer status);
}
